﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Http;
using BLL;
using Model;
using Common;
using AdminWeb.Filter;
using AdminWeb.Models;
using System.IO;

namespace AdminWeb.Controllers
{
    [Area("Admin")]
    public class BlogUploadController : Controller
    {
        [CheckAdminLogin]
        public ActionResult List(int page = 1)
        {
            Blog_UploadBLL bll = new Blog_UploadBLL();
            string search_url = "";
            string extsql = "";
            int pageCount = 10;
            string blogid_search = Request.Query["blogid_search"];
            if (!string.IsNullOrEmpty(blogid_search))
            {
                search_url = "&blogid_search=" + blogid_search;
                extsql += " and ul_memid like '%" + blogid_search + "%'";
            }
            ViewBag.mess = bll.GetPage(extsql, page, pageCount);
            ViewBag.blogid_search = blogid_search;
            ViewBag.search_url = search_url;
            ViewBag.pageCount = pageCount;
            ViewBag.request_url = Request.Path.ToString();
            return View();
        }
        [CheckAdminLoginAjax]
        public string Delete()
        {
            Member admin = BaseOperater.getAdmin(HttpContext);
            Blog_UploadBLL bll = new Blog_UploadBLL();
            return JSONHelper.SerializeObject(bll.delete(Request.Query["id"], admin));
        }


    }
}